import os.path
import sys
import matplotlib.pyplot as plt
import numpy as np


# 这一段分析的时候才加
# plt.subplot(121)
# plt.plot(sizes)
# plt.title(len(sizes))
# plt.subplot(122)
# mem = [3*np.array(sizes[:i]).sum() for i in range(len(sizes))]
# plt.plot(mem)
# plt.xlabel('samples to accumulate')
# plt.ylabel('approximate mem in GB')
# plt.show()


if __name__ == "__main__":
    filename = "picked_filenames_rdPct0.50_0.60__writeNum5M_80M_allNum10M_150M.txt"
    with open(filename) as f:
        csv_names = f.readline().split()

    with open("./scripts/single_runs.sh", "w") as f:
        f.write("chmod +x ./scripts/trace_one.sh\n")
        for csv_name in csv_names:
            f.write("sudo ./scripts/trace_one.sh %s\n" % csv_name)
        f.write("python ./scripts/plot_single_run_group.py %s" % filename)